repo.or.cz
/
andmenj-acm.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Solving 10385 - Duathlon (Ternary search)
[andmenj-acm.git]
/
10098 - Generating fast, sorted permutation
/
10098.cpp
blob
eeb680dc1e36d1f1825b63870a87ac45fd887641
1
#include <iostream>
2
#include <algorithm>
3
#include <string>
4
5
using namespace
std
;
6
7
int
main
(){
8
int
n
;
9
cin
>>
n
;
10
while
(
n
--){
11
string s
;
12
cin
>>
s
;
13
sort
(
s
.
begin
(),
s
.
end
());
14
do
{
15
cout
<<
s
<<
endl
;
16
}
while
(
next_permutation
(
s
.
begin
(),
s
.
end
()));
17
cout
<<
endl
;
18
}
19
return
0
;
20
}